home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-05-01 | 2.8 KB | 76 lines | [TEXT/MPS ] |
- % ---------------------------------------------------------------------------
- % Class MACProcess
- %
- % Part of the Lund Software interface to Macintosh Toolbox
- % MACProcess is part of the programming interface.
- % Processes are used to capture events that are directed to
- % a window. The MACProcessMGR are receiving the events from the
- % Mac and distributes them to the concerned window.
- % For each Window - create also a MACProcess and hook it to the window
- % by calling ControllingWindow in MACProcessMGR.
- %
- % 890406/Boris Magnusson
- %
- % ---------------------------------------------------------------------------
- External class MacEvent="::SInterfaces:MacEvent";
- External class MacUtilities="::SInterfaces:MacUtilities";
- External class MacToolConst="::SInterfaces:MacToolConst";
- class MACProcess;
- virtual: ! -- called from procmgr to signal special "events": ;
- procedure doGoAway is procedure doGoAway;;
- procedure doSize is
- procedure doSize(v,h); integer v,h;;
- begin
- ref(macUtilities) Util; ! To access toolbox general utils;
- ref(macToolConst) TConst;! To access Tool-constants ;
- ! Both assigned by procmgr at start-time;
- !----------------------------- Attributes known by processmgr - ;
- ! --- Used as detach/call "parameters". --- ;
- ref(MacEvent) CurrentEvent; ! -- refers to System event record;
- integer CurrentFindresult;
- Boolean WaitingForEvent; ! True to signal idle to procmgr;
- short integer CurrentMask; ! Holds mask for accepted Event cods;
- boolean Terminate; ! Set to true when process is dying.;
- !-----------------------------;
- ! Two procedures to manipulate the CurrentMask, they take a
- ! Eventcode (0,1,,15) as defined in macToolConst.
- ! sets/clears corresponding bit in CurrentMask.
- ! * EnableEvent(TConst.EveryEvent) enables all events.
- ! * DisableEvent(TConst.EveryEvent) disables all events .
- ;
- procedure EnableEvent(EventCode); short integer EventCode;
- begin
- if EventCode=TCONST.everyEvent then CurrentMask:=-1 !all bits;
- else
- Currentmask:=Util.BitOr(
- Util.BitShift(1,EventCode) , CurrentMask );
- end -- EnableEvent --;
-
- procedure DisableEvent(EventCode); short integer EventCode;
- begin
- if EventCode=TCONST.EveryEvent then CurrentMask:=0 ! no bits;
- else
- Currentmask:=Util.BitAnd(
- Util.BitNot(Util.BitShift(1,EventCode)) ,
- CurrentMask );
- end --- DisableEvent --;
-
- ! Wait for an event targeted at my window. ;
- integer procedure WaitNextEvent(theEvent);
- ref(MacEvent) theEvent;
- begin
- WaitingForEvent:=True;
- detach;
- CurrentEvent.copyevent(theEvent);
- WaitNextEvent:=CurrentFindResult;
- end --- Input ---;
-
- ! --- dummy versions of virtual procedures --;
- procedure doGoaway; ;
- procedure doSize(v,h); integer v,h;;
-
- ! -- Initialize / Terminate -- ;
- Detach; ! do not do anything until activated !;
- inner;
- terminate:=true; !Taken out of queues when returning;
- end --- Mac Process --- ;